<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>商品订单列表</title>
    <script type="text/javascript" src="../lay-excel/jquery-3.2.1.min.js"></script>
    <link rel="stylesheet" href="../lay-excel/layui/src/css/layui.css">
    <script src="../lay-excel/layui/src/layui.js"></script>
    <link rel="shortcut icon" href="/img/pro-logo.png">
   <!-- <link rel="stylesheet" href="css/Operation_auditList.css">-->

</head>
<style>
    body{
        background-color:#F6F7F9;

    }
    .OpeHome_1{
        background-color:#F3F3F3;
    }
    .OpeHome_1 span{
        line-height:40px;
        margin-left: 10px;
        font-weight:bolder;
    }
    .OpeHome_1 button{
        margin-top: 5px;
        margin-bottom: 5px;
        height: 30px;
        width: 75px;
        line-height: 30px;
        font-size: 10px;
    }
    .OpeHome_1 button .refresh{
        font-size: 12px;
    }
    .OpeHome_1 button:hover {
        border-color: #1ABC9C;
        color: #1ABC9C;
    }
    .OpeHome_1 button i:hover {
        color: #1ABC9C;
    }

    /*筛选查询*/
    #row_2{
        background-color: #F3F3F3;
        margin-left: 2%;
        margin-right: 2%;
        margin-top: 1%;
        height: 40px;
        border: 1px solid #E4E4E4;
    }
    #span_2{
        margin-left: 1%;
        line-height: 40px;
        font-weight: normal;
    }
    #btn_1{
        width: 70px;
        margin-top: 5px;
        margin-bottom: 5px;
    }
    /*搜索框*/
    #searchBox{
        background-color:#F6F7F9;
        margin-left: 2%;
        margin-right: 2%;
        height: 50px;
        border: 1px solid #E4E4E4;
    }
    #div_1{
        margin-left: 40px;
    }
    .label_1{
        line-height: 34px;
    }
    #productName{
        width: 170px;
        height: 37px;
        margin-top: 5px;
        margin-bottom: 4px;
    }
    #zhifu{
        margin-top: 5px;
    }
    #div_2{
        margin-left: 40px;
    }
    #see {
        width: 60px;
        margin-bottom: 5px;
    }

    /*内容*/
    #div_3{
        background-color: #F3F3F3;
        margin-left: 2%;
        margin-right: 2%;
        margin-top: 1.5%;
    }
    #div_4{
        float: left;
    }
    #ReviewStatus{
        margin-top: 10px;
        margin-left: 2%;
    }
    #ReviewStatus button span:hover{
        border-color: #1ABC9C;
        color: #1ABC9C;
    }
    .i_1{
        color:red;
    }

</style>
<body>
<div class="layui-container">
    <!--头部-->
    <div class="layui-row" >
        <div class="layui-col-xs10 layui-col-sm10 layui-col-md10 layui-col-lg10 OpeHome_1">
            <!--<div style="height: 10px;width: 5px;background-color: #00FF00"></div>-->
            <span id="span_1">商品订单列表</span>
        </div>
        <div class="layui-col-xs1 layui-col-sm1 layui-col-md1 layui-col-lg1 OpeHome_1">
            <button type="button" class="layui-btn layui-btn-primary button_1" id="refreshs">
                <i class="layui-icon layui-icon-refresh refresh"></i>刷新
            </button>
        </div>
        <div class="layui-col-xs1 layui-col-sm1 layui-col-md1 layui-col-lg1 OpeHome_1">
            <button type="button" class="layui-btn layui-btn-primary button_1" id="back">
                <i class="layui-icon layui-icon-left refresh"></i>返回
            </button>
        </div>
    </div>

    <!--状态选择-->
    <div class="layui-row" id="ReviewStatus">
        <button type="button" id="AllOrderss" class="layui-btn layui-btn-primary"><span>全部订单(<i class="i_1" id="AllOrders"></i>)</span></button>
        <button type="button" id="payments" class="layui-btn layui-btn-primary"><span>待付款(<i class="i_1" id="payment"></i>)</span></button>
        <button type="button" id="sendGoodss" class="layui-btn layui-btn-primary"><span>待发货(<i class="i_1" id="sendGoods"></i>)</span></button>
        <button type="button" id="HasBeenShipps" class="layui-btn layui-btn-primary"><span>已发货(<i class="i_1" id="HasBeenShipp"></i>)</span></button>
        <button type="button" id="completeds" class="layui-btn layui-btn-primary"><span>已签收(<i class="i_1" id="completed"></i>)</span></button>
        <button type="button" id="ForRefunds" class="layui-btn layui-btn-primary"><span>待退货(<i class="i_1" id="ForRefund"></i>)</span></button>
        <button type="button" id="TheReturns" class="layui-btn layui-btn-primary"><span>退货中(<i class="i_1" id="TheReturn"></i>)</span></button>
        <button type="button" id="HaveToReturns" class="layui-btn layui-btn-primary"><span>已退货(<i class="i_1" id="HaveToReturn"></i>)</span></button>
        <button type="button" id="cancelleds" class="layui-btn layui-btn-primary"><span>已取消(<i class="i_1" id="cancelled"></i>)</span></button>
    </div>

    <!--筛选查询-->
    <div class="layui-row" id="row_2">
        <div class="layui-col-xs11 layui-col-sm11 layui-col-md11 layui-col-lg11">
            <span id="span_2"><i class="layui-icon layui-icon-search">筛选查询</i></span>
        </div>
        <div class="layui-col-xs1 layui-col-sm1 layui-col-md1 layui-col-lg1">
            <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" id="btn_1" onclick="search()">
                高级检索
            </button>
        </div>
    </div>

    <!--搜索框-->
    <div id="searchBox">
        <form class="layui-form" action="">
            <div class="layui-form-item">
                <div class="layui-inline" id="div_1">
                    <label class="layui-form-label label_1">订单编号：</label>
                    <div class="layui-input-block">
                        <input type="text" name="orderNo" class="layui-input" placeholder="请输入订单编号" id="productName"/>
                    </div>
                </div>
                <div class="layui-inline" style="margin-left: -12px;">
                    <label class="layui-form-label " style="line-height: 25px;">用户账号：</label>
                    <div class="layui-input-block">
                        <input type="text" name="account" class="layui-input" placeholder="请输入用户账号" id="categoryId"/>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label label_1">支付方式：</label>
                    <div class="layui-input-block" id="zhifu">
                        <select  id="orderPaymentChannel">
                            <option value="">请选择支付方式</option>
                            <option value="4">未支付</option>
                            <option value="2">微信支付</option>
                            <option value="3">余额支付</option>
                            <option value="5">支付宝支付</option>
                        </select>
                    </div>
                </div>
                <div  class="layui-inline" id="div_2">
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-sm" id="see" onclick="seek()">
                        搜索
                    </button>
                </div>
            </div>
        </form>
    </div>

    <!--内容-->
    <div class="layui-row" id="div_3">
        <table id="table_id"></table>
        <!-- 自定义table按钮 -->
        <div class="layui-hide layui-btn-container" id="toolbar_id">
            <div id="div_4">
                <span><i class="layui-icon">&#xe649;&nbsp;</i>商品订单列表</span>
            </div>
        </div>
    </div>

    <!--高级检索-->
    <input type="hidden" name="orderStatus1" > <!--订单状态-->
</div>

<!--<script src="js/Operation_auditList.js"></script>-->

</body>
<script>
    var form;
    var table;
    var layer;
    var $;
    var upload;
    layui.use(['layer','form','table','upload'],function(){
        form = layui.form;
        table=layui.table;
        layer=layui.layer;
        $=layui.$;
        upload=layui.upload;

        //商品订单总数
        OrdersTotal(3)
        //待付款订单总数
        payment(3,2);
        //待发货订单总数
        sendGoods(3,4);
        //已发货订单总数
        HasBeenShipp(3,5);
        //已签收订单总数
        completed(3,6);
        //待退货订单总数
        ForRefund(3,7);
        //退货中订单总数
        TheReturn(3,8);
        //已退货订单总数
        HaveToReturn(3,9);
        //已取消订单总数
        cancelled(3,10);
        //商品订单列表
        show(3);

    })

    //统计订单数量
    //统计全部商品订单的数量
    function OrdersTotal(orderType){
        $.post("/OpeHome/getOrderNumber",{"orderType":orderType},function (data) {
            $("#AllOrders").text(data.obj);
        });
    }
    //统计待付款商品订单的数量
    function payment(orderType,orderStatus){
        $.post("/OpeHome/getOrderNumber",{"orderType":orderType,"orderStatus":orderStatus},function (data) {
            $("#payment").text(data.obj);
        });
    }
    //统计待发货商品订单的数量
    function sendGoods(orderType,orderStatus){
        $.post("/OpeHome/getOrderNumber",{"orderType":orderType,"orderStatus":orderStatus},function (data) {
            $("#sendGoods").text(data.obj);
        });
    }
    //统计已发货商品订单的数量
    function HasBeenShipp(orderType,orderStatus){
        $.post("/OpeHome/getOrderNumber",{"orderType":orderType,"orderStatus":orderStatus},function (data) {
            $("#HasBeenShipp").text(data.obj);
        });
    }
    //统计已签收商品订单的数量
    function completed(orderType,orderStatus){
        $.post("/OpeHome/getOrderNumber",{"orderType":orderType,"orderStatus":orderStatus},function (data) {
            $("#completed").text(data.obj);
        });
    }
    //统计待退货商品订单的数量
    function ForRefund(orderType,orderStatus){
        $.post("/OpeHome/getOrderNumber",{"orderType":orderType,"orderStatus":orderStatus},function (data) {
            $("#ForRefund").text(data.obj);
        });
    }
    //统计退货中商品订单的数量
    function TheReturn(orderType,orderStatus){
        $.post("/OpeHome/getOrderNumber",{"orderType":orderType,"orderStatus":orderStatus},function (data) {
            $("#TheReturn").text(data.obj);
        });
    }
    //统计已退货商品订单的数量
    function HaveToReturn(orderType,orderStatus){
        $.post("/OpeHome/getOrderNumber",{"orderType":orderType,"orderStatus":orderStatus},function (data) {
            $("#HaveToReturn").text(data.obj);
        });
    }
    //统计已取消商品订单的数量
    function cancelled(orderType,orderStatus){
        $.post("/OpeHome/getOrderNumber",{"orderType":orderType,"orderStatus":orderStatus},function (data) {
            $("#cancelled").text(data.obj);
        });
    }

    //页面搜索
    var seek=function(){
        var orderStatus=$('input[name=orderStatus1]').val();
        var orderNo=$('input[name=orderNo]').val();
        var account=$('input[name=account]').val();
        var orderPaymentChannel=$('#zhifu option:selected').val();

        $.post("/OpeHome/addOrdersGoods", {"orderType":3,"orderStatus":orderStatus,"orderNo":orderNo,"account":account,"orderPaymentChannel":orderPaymentChannel},
            function (data) {
                tables(data.obj);
            });
    }

    //高级检索
    function search(){
        var prsa=$("input[name='productSate1']").val();
        var name1=$("input[name='productName1']").val();
        var cate=$("input[name='categroyName1']").val();
        var trna=$("input[name='trueName1']").val();
        var code1=$("input[name='productCode1']").val();
        var price=$("input[name='currentpriceProduct1']").val();

        $.post("/OpeHome/getCommodityAudit",
            {"productCode":code1,"productName":name1,"currentpriceProduct":price,"categroyName":cate,"productSate":prsa,"trueName":trna},
            function (data) {
                console.log(data.obj);
                tables(data.obj);
            });
    }

    //展示table表格
    function showtables(orderType,orderStatus){
        $.post("/OpeHome/addOrdersGoods",{"orderType":orderType,"orderStatus":orderStatus}, function (data) {
            tables(data.obj);
        });
    }
    //table表格信息
    function tables(data){
        table.render({
            elem:"#table_id",//容器
            data:data,
            title:"商品订单列表",
            limit:10,//分页显示条数
            toolbar:"#toolbar_id",
            page:true,
            cols:[[//定义列
                {type:'checkbox',align:'center',width:50},//复选框靠左
                {title:'序号',align:'center',templet:function(data){
                        return data.LAY_INDEX;
                    }},
                {field:"order_no",title:"订单编号",align:'center',width:170},
                {field:"payment_time",title:"提交时间",align:'center',width:170,templet:function(d){
                        var date=d.payment_time;
                        date = date.slice(0, date.indexOf("."));
                        date = date.replaceAll('T',' ');
                        return date;
                    }},
                {field:"account",title:"用户账号",align:'center',width:150},
                {field:"logistics_fee",title:"订单金额",align:'center',width:100,templet:function(data){
                            return  " ￥"+data.logistics_fee;
                    }},
                {field:"order_payment_channel",title:"支付方式",align:'center',width:110,templet:function(data){
                        if(data.order_payment_channel==2){
                            return  "微信支付 ";
                        }else if(data.order_payment_channel==3){
                            return  " 余额支付";
                        }else if(data.order_payment_channel==4){
                            return  " 未支付";
                        }else if(data.order_payment_channel==5){
                            return  " 支付宝支付";
                        }
                    }},
                {field:"order_source",title:"订单来源",align:'center',width:110,templet:function(data){
                        if(data.order_source==2){
                            return  "小程序 ";
                        }else if(data.order_source==3){
                            return  " app";
                        }
                    }},
                {field:"order_status",title:"订单状态",align:'center',width:110,templet:function(data){
                        if(data.order_status==2){
                            return  "待付款";
                        }else if(data.order_status==4){
                            return  "待发货";
                        }else if(data.order_status==5){
                            return  "已发货";
                        }else if(data.order_status==6){
                            return  "已签收";
                        }else if(data.order_status==7){
                            return  "申请退货";
                        }else if(data.order_status==8){
                            return  "退货中";
                        }else if(data.order_status==9){
                            return  "已退货";
                        }else if(data.order_status==10){
                            return  "取消交易";
                        }
                    }},
                {field:"order_type",title:"类型",align:'center',width:90,templet:function(data){
                        return  "<p style='color: #1ABC9C'>商品</p> ";
                    }},
                {field:"",title:"操作",align:'center',width:190,templet:function(data){
                        if(data.order_status==2||data.order_status==3||data.order_status==4||data.order_status==7||data.order_status==8||data.order_status==9||data.order_status==10){
                            return  "<a style='color:#1ABC9C;cursor:pointer;' onclick='javascript:check(\""+data.order_id+"\");'>查看订单 </a>   ";
                        }else if(data.order_status==5||data.order_status==6){
                            return  "<a style='color:#1ABC9C;cursor:pointer;' onclick='javascript:check(\""+data.order_id+"\");'>查看订单 </a>   "+
                                     "<a style='color:#1ABC9C;cursor:pointer;' onclick='javascript:edit(\""+data.order_id+"\");'> 订单跟踪</a>   ";
                        }
                    }}
            ]]
        });
    }

    //展示table表格
    function show(orderType){
        $(" #AllOrderss").removeClass("layui-btn-primary");
        $(" #payments").addClass("layui-btn-primary");
        $(" #sendGoodss").addClass("layui-btn-primary");
        $(" #HasBeenShipps").addClass("layui-btn-primary");
        $(" #completeds").addClass("layui-btn-primary");
        $(" #ForRefunds").addClass("layui-btn-primary");
        $(" #TheReturns").addClass("layui-btn-primary");
        $(" #HaveToReturns").addClass("layui-btn-primary");
        $(" #cancelleds").addClass("layui-btn-primary");
        showtables(orderType);
    }
    //全部商品的订单列表
    $('#AllOrderss').on('click',function(){
        $(" #AllOrderss").removeClass("layui-btn-primary");
        $(" #payments").addClass("layui-btn-primary");
        $(" #sendGoodss").addClass("layui-btn-primary");
        $(" #HasBeenShipps").addClass("layui-btn-primary");
        $(" #completeds").addClass("layui-btn-primary");
        $(" #ForRefunds").addClass("layui-btn-primary");
        $(" #TheReturns").addClass("layui-btn-primary");
        $(" #HaveToReturns").addClass("layui-btn-primary");
        $(" #cancelleds").addClass("layui-btn-primary");
        showtables(3);
    })
    //待付款商品的订单列表
    $('#payments').on('click',function(){
        $('input[name=orderStatus1]').val(2);
        $(" #AllOrderss").addClass("layui-btn-primary");
        $(" #payments").removeClass("layui-btn-primary");
        $(" #sendGoodss").addClass("layui-btn-primary");
        $(" #HasBeenShipps").addClass("layui-btn-primary");
        $(" #completeds").addClass("layui-btn-primary");
        $(" #ForRefunds").addClass("layui-btn-primary");
        $(" #TheReturns").addClass("layui-btn-primary");
        $(" #HaveToReturns").addClass("layui-btn-primary");
        $(" #cancelleds").addClass("layui-btn-primary");
        showtables(3,2);
    })
    //待发货商品的订单列表
    $('#sendGoodss').on('click',function(){
        $('input[name=orderStatus1]').val(4);
        $(" #AllOrderss").addClass("layui-btn-primary");
        $(" #payments").addClass("layui-btn-primary");
        $(" #sendGoodss").removeClass("layui-btn-primary");
        $(" #HasBeenShipps").addClass("layui-btn-primary");
        $(" #completeds").addClass("layui-btn-primary");
        $(" #ForRefunds").addClass("layui-btn-primary");
        $(" #TheReturns").addClass("layui-btn-primary");
        $(" #HaveToReturns").addClass("layui-btn-primary");
        $(" #cancelleds").addClass("layui-btn-primary");
        showtables(3,4);
    })
    //已发货商品的订单列表
    $('#HasBeenShipps').on('click',function(){
        $('input[name=orderStatus1]').val(5);
        $(" #AllOrderss").addClass("layui-btn-primary");
        $(" #payments").addClass("layui-btn-primary");
        $(" #sendGoodss").addClass("layui-btn-primary");
        $(" #HasBeenShipps").removeClass("layui-btn-primary");
        $(" #completeds").addClass("layui-btn-primary");
        $(" #ForRefunds").addClass("layui-btn-primary");
        $(" #TheReturns").addClass("layui-btn-primary");
        $(" #HaveToReturns").addClass("layui-btn-primary");
        $(" #cancelleds").addClass("layui-btn-primary");
        showtables(3,5);
    })
    //已签收商品的订单列表
    $('#completeds').on('click',function(){
        $('input[name=orderStatus1]').val(6);
        $(" #AllOrderss").addClass("layui-btn-primary");
        $(" #payments").addClass("layui-btn-primary");
        $(" #sendGoodss").addClass("layui-btn-primary");
        $(" #HasBeenShipps").addClass("layui-btn-primary");
        $(" #completeds").removeClass("layui-btn-primary");
        $(" #ForRefunds").addClass("layui-btn-primary");
        $(" #TheReturns").addClass("layui-btn-primary");
        $(" #HaveToReturns").addClass("layui-btn-primary");
        $(" #cancelleds").addClass("layui-btn-primary");
        showtables(3,6);
    })
    //待退货商品的订单列表
    $('#ForRefunds').on('click',function(){
        $('input[name=orderStatus1]').val(7);
        $(" #AllOrderss").addClass("layui-btn-primary");
        $(" #payments").addClass("layui-btn-primary");
        $(" #sendGoodss").addClass("layui-btn-primary");
        $(" #HasBeenShipps").addClass("layui-btn-primary");
        $(" #completeds").addClass("layui-btn-primary");
        $(" #ForRefunds").removeClass("layui-btn-primary");
        $(" #TheReturns").addClass("layui-btn-primary");
        $(" #HaveToReturns").addClass("layui-btn-primary");
        $(" #cancelleds").addClass("layui-btn-primary");
        showtables(3,7);
    })
    //退货中商品的订单列表
    $('#TheReturns').on('click',function(){
        $('input[name=orderStatus1]').val(8);
        $(" #AllOrderss").addClass("layui-btn-primary");
        $(" #payments").addClass("layui-btn-primary");
        $(" #sendGoodss").addClass("layui-btn-primary");
        $(" #HasBeenShipps").addClass("layui-btn-primary");
        $(" #completeds").addClass("layui-btn-primary");
        $(" #ForRefunds").addClass("layui-btn-primary");
        $(" #TheReturns").removeClass("layui-btn-primary");
        $(" #HaveToReturns").addClass("layui-btn-primary");
        $(" #cancelleds").addClass("layui-btn-primary");
        showtables(3,8);
    })
    //已退货商品的订单列表
    $('#HaveToReturns').on('click',function(){
        $('input[name=orderStatus1]').val(9);
        $(" #AllOrderss").addClass("layui-btn-primary");
        $(" #payments").addClass("layui-btn-primary");
        $(" #sendGoodss").addClass("layui-btn-primary");
        $(" #HasBeenShipps").addClass("layui-btn-primary");
        $(" #completeds").addClass("layui-btn-primary");
        $(" #ForRefunds").addClass("layui-btn-primary");
        $(" #TheReturns").addClass("layui-btn-primary");
        $(" #HaveToReturns").removeClass("layui-btn-primary");
        $(" #cancelleds").addClass("layui-btn-primary");
        showtables(3,9);
    })
    //已取消商品的订单列表
    $('#cancelleds').on('click',function(){
        $('input[name=orderStatus1]').val(10);
        $(" #AllOrderss").addClass("layui-btn-primary");
        $(" #payments").addClass("layui-btn-primary");
        $(" #sendGoodss").addClass("layui-btn-primary");
        $(" #HasBeenShipps").addClass("layui-btn-primary");
        $(" #completeds").addClass("layui-btn-primary");
        $(" #ForRefunds").addClass("layui-btn-primary");
        $(" #TheReturns").addClass("layui-btn-primary");
        $(" #HaveToReturns").addClass("layui-btn-primary");
        $(" #cancelleds").removeClass("layui-btn-primary");
        showtables(3,10);
    })

</script>